Django - need to split a table across multiple locations [closed]

Posted by MikeRand on Pro Webmasters See other posts from Pro Webmasters or by MikeRand
Published on 2011-01-05T17:17:03Z Indexed on 2011/01/05 17:59 UTC
Read the original article Hit count: 186

Filed under:

Hi all,

I have a Django project to track our company's restructuring projects. Here's the very simple model:

class Project(models.Model):
    code = models.CharField(max_length=30)
    description = models.CharField(max_length=60)

class Employee(models.Model):
    project = models.ForeignKey(Project)
    employee_id = models.IntegerField()
    country_code = models.CharField(max_length=3)
    severance = models.IntegerField()

Due to regulations in some European countries, I'm not allowed to keep employee-level severance information in a database that sits on a box outside of that country.

In Django, how do I manage the need to have my Employee table split across multiple databases based on an Employee attribute (i.e. country_code) in a way that doesn't impact anything else in the project (e.g. views, templates, admin)?

Thanks,

Mike

© Pro Webmasters or respective owner

Related posts about django